package day_05;

import java.util.Random;

/**
 * @ClassName Day05Homework_12
 * @Description TODO
 * @Author hp
 * @Date 2021/6/7 18:22
 * @Version 1.0
 **/
public class Day05Homework_12 {
    public static void main(String[] args) {
        for (int i = 0; i <10 ; i++) {
            captcha();
        }
    }
    public static void captcha() {
        char[] chars = new char[6];
        Random random = new Random();

        for (int i = 0; i < chars.length; i++) {
            int random1 = random.nextInt(3);
            if (random1 == 0) {
                chars[i] = (char) (random.nextInt(10) + 48);
            } else if (random1 == 1) {
                chars[i] = (char) (random.nextInt(27) + 65);
            } else {
                chars[i] = (char) (random.nextInt(27) + 97);
            }

        }
        System.out.print("随机验证码:");
        for (int i = 0; i < chars.length; i++) {
            char aChar = chars[i];
            System.out.print(aChar);
        }
        System.out.println();
    }
}


